<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>login</title>
    <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>

</head>
<body>
    <div>
        <label>用户名</label><input type="text" class="text" id="username"
                                     placeholder="用户名" name="username" required tabindex="1">
    </div>
    <div>
        <label>密    码</label><input type="password"
                                    class="text" id="password" placeholder="密码" required name="password"
                                    tabindex="2"><br>
    </div>
    <br>
    <div>
        <button type="reset" value="重置" id="reset">重置</button>
        <button type="button" value="登录" id="doLogin" onclick="doLogin()">登录</button>
    </div>
</body>
<script>
    function doLogin(){
        var username = document.getElementById("username").value;
        var password = document.getElementById("password").value;
        console.log(username)
        console.log(password)
        $.ajax({
            type: "POST",
            url: "/users/login.do",
            data: {
                "username":username,
                "password":password,
            },
            success: function(data){
                console.log(data);
            },
            error: function (data) {
                console.log(data);
            }
        });
    }
</script>
</html>